#ifndef __EchoServer_H__
#define __EchoServer_H__
#include "TcpConnection.h"
#include "TcpServer.h"
#include "Threadpool.h"
#include "TaskType.h"
#include "UserRegisterSection.h"
#include "UserLoginSection.h"

#include <iostream>
using std::cout;
using std::endl;
using std::string;

namespace rocket 
{

class EchoServer
{
public:
    EchoServer(unsigned short port, 
               const string & ip = "127.0.0.1",
               size_t threadNum = 4,
               size_t queSize = 10);
//开启服务器
    void start();

//处理已经新建立的链接的业务
    void onConnection(wd::TcpConnectionPtr conn);

//处理已经建立的链接的业务
    void onMessage(wd::TcpConnectionPtr conn);
    
//处理已经要关闭链接的业务
    void onClose(wd::TcpConnectionPtr conn);

private:
    wd::TcpServer _server;
    wd::Threadpool _threadpool;
};

}//end of namespace rocket


#endif

